<script setup lang='ts'>
import { inject } from 'vue';

const realMoney = inject<number>("money", 0)

const costMoneyFunc = inject<(money: number) => void>("cost")
const cutMoney = () => {
    if (costMoneyFunc) {
        costMoneyFunc(100)
    }
}

</script>

<template>
    <h3>我是孙子</h3>
    <p>得到爷爷给的零花钱：{{ realMoney }}</p>
    <button @click="cutMoney">买一个最新款的华为Meta70Pro</button>
</template>

<style scoped></style>